﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Pibby.Core.IO;

namespace Pibby.Core
{
	public class Transferable : Identifiable, ITransferable
	{
		#region Constructor 

		public Transferable()
		{
		}

		public Transferable(string source)
			: this (source, string.Empty)
		{
		}

		public Transferable(string source, string targetFolder)
			: base ()
		{
			this.Source = source;
			this.TargetFolder = targetFolder;

			this.FriendlyName = this.FileName;
		}

		#endregion

		#region Methods

		public override string ToString()
		{
			if (string.IsNullOrEmpty(this.FriendlyName))
				return this.Source;

			return string.Format(System.Globalization.CultureInfo.CurrentUICulture, "{0} : {1}", this.FriendlyName, this.Source);
		}

		#endregion

		#region Properties

		public string Source
		{
			get;
			set;
		}

		public string TargetFolder
		{
			get;
			set;
		}

		public string TargetPath
		{
			get { return System.IO.Path.Combine(this.TargetFolder, this.FileName); }
		}

		public string FileName
		{
			get { return System.IO.Path.GetFileName(this.Source); }
		}

		public string FriendlyName
		{
			get;
			set;
		}

		public long Size
		{
			get;
			set;
		}

		public object Tag { get; set; }

		#endregion

	}
}
